package com.showgood.model {
	import com.showgood.core.AbstractProxy;
	import com.showgood.config.Config;
	import com.showgood.vo.LoginVO;
	import com.showgood.vo.RemoteMessage;
	import com.showgood.vo.VoFactory;
	import org.puremvc.as3.patterns.proxy.Proxy;
	
	/**
	 * @author bianpeng
	 */
	public class LoginProxy extends AbstractProxy {
		
		public function LoginProxy() {
		}
		
		public function startLogin():void {
			sangoFacade.registerProxyByType(new SocketProxy());
		}
		/**
		 * @param	username
		 * @param	password
		 */
		public function login(username:String, password:String):void {
			_logger.info('login request');
			var _socket:SocketProxy = socketProxy;
			var _vo:LoginVO = VoFactory.instance.create(VoFactory.VO_LOGINVO) as LoginVO;
			// 用户名密码, 用于验证
			_vo.username = username;
			_vo.password = password;
			// 版本验证
			_vo.version = VoFactory.VERSION;
			_socket.sendSingleVo(RemoteMessage.REMOTE_LOGIN, 0, _vo);
		}
	}
}

